/**
 * @file     isPowerOfThree.js
 * @brief    [326. 3 的幂](https://leetcode.cn/problems/power-of-three/description/)
 * @author   Zhu
 * @date     2023-02-12 16:25
 */

/**
 * @param {number} n
 * @return {boolean}
 */
var isPowerOfThree = function (n) {
    if (n <= 0) return false;
    while (n % 3 === 0) {
        n = n / 3;
    }

    return n === 1;
};
